package io.aircraft.modules.wms.controller;

import io.aircraft.common.page.PageData;
import io.aircraft.common.utils.Result;
import io.aircraft.modules.wms.dto.CallbackRecordDTO;
import io.aircraft.modules.wms.service.CallbackRecordService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import java.util.Map;


/**
 * 回调记录
 *
 * @author Cycle gengruyi01@163.com
 * @since 1.0.0 2022-11-08
 */
@RestController
@RequestMapping("wms/callback-record")
public class CallbackRecordController {
    @Autowired
    private CallbackRecordService callbackRecordService;

    @GetMapping("page")
    @RequiresPermissions("wms:callback-record:page")
    public Result<PageData<CallbackRecordDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
        PageData<CallbackRecordDTO> page = callbackRecordService.page(params);

        return new Result<PageData<CallbackRecordDTO>>().ok(page);
    }

    @GetMapping("{id}")
    @RequiresPermissions("wms:callback-record:info")
    public Result<CallbackRecordDTO> get(@PathVariable("id") Long id){
        CallbackRecordDTO data = callbackRecordService.get(id);

        return new Result<CallbackRecordDTO>().ok(data);
    }
}